package com.byxx.deviceMonitoringSys.ma;

import javax.swing.UnsupportedLookAndFeelException;

import com.byxx.deviceMonitoringSys.ui.DeviceMonitorFrame;
import com.byxx.deviceMonitoringSys.util.InstallConfig;
import com.byxx.deviceMonitoringSys.util.OpDeviceSysEnter;

public class DeviceMonitorControl {
	
	private DeviceMonitorFrame deviceMonitorFrame;
	
	private static DeviceMonitorControl instance;
	
	public OpDeviceSysEnter opDeviceSysEnter;
	
	public static DeviceMonitorControl getInstance() {
		if(instance == null) {
			instance = new DeviceMonitorControl();
		}
		return instance;
	}
	
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		try {
			InstallConfig.getInstance().installLoginConfig();
			javax.swing.UIManager.setLookAndFeel(javax.swing.UIManager.getSystemLookAndFeelClassName());
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		DeviceMonitorControl deviceMonitorControl = new DeviceMonitorControl();
		deviceMonitorControl.getOpDeviceSysEnter().enter();
//		deviceMonitorControl.getDeviceMonitorFrame();
//		deviceMonitorControl.getDeviceMonitorFrame().getPaFloorJZCMap().refreshAllDevices();
//		deviceMonitorControl.getDeviceMonitorFrame().getPaFloorJZCMap().refreshAllRegions();
	}

	public DeviceMonitorFrame getDeviceMonitorFrame() {
		if(deviceMonitorFrame == null) {
			deviceMonitorFrame = new DeviceMonitorFrame(this);
//			deviceMonitorFrame.setVisible(true);
//			deviceMonitorFrame.getPaFloorJZCMap().getCenterSplitPaneNew().setDividerLocation(0.8);
			
		}
		return deviceMonitorFrame;
	}

	public void setDeviceMonitorFrame(DeviceMonitorFrame deviceMonitorFrame) {
		this.deviceMonitorFrame = deviceMonitorFrame;
	}

	public OpDeviceSysEnter getOpDeviceSysEnter() {
		if(opDeviceSysEnter==null) {
			opDeviceSysEnter = new OpDeviceSysEnter(this);
		}
		return opDeviceSysEnter;
	}

	public void setOpDeviceSysEnter(OpDeviceSysEnter opDeviceSysEnter) {
		this.opDeviceSysEnter = opDeviceSysEnter;
	}

}
